package com.z3n.entities;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the Z3N_GROUPS_USERS database table.
 * 
 */
@Entity
@Table(name="Z3N_GROUPS_USERS")
@NamedQueries({@NamedQuery(name = "getZ3nGroupsUserByZ3nUser", query = "SELECT z FROM Z3nGroupsUser z WHERE z.z3nUser.userId = :z3nUser_userId"),@NamedQuery(name = "getZ3nGroupsUserByZ3nGroup", query = "SELECT z FROM Z3nGroupsUser z WHERE z.z3nGroup.groupId = :z3nGroup_groupId"),
@NamedQuery(name = "getZ3nGroupsUserByGroupLevel", query = "SELECT z FROM Z3nGroupsUser z WHERE z.groupLevel = :groupLevel"),
@NamedQuery(name = "getZ3nGroupsUserByGuId", query = "SELECT z FROM Z3nGroupsUser z WHERE z.guId = :guId")})
public class Z3nGroupsUser implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="GU_ID")
	private int guId;

	@Column(name="GROUP_LEVEL")
	private int groupLevel;

	//bi-directional many-to-one association to Z3nGroup
    @ManyToOne
	@JoinColumn(name="GROUP_ID")
	private Z3nGroup z3nGroup;

	//bi-directional many-to-one association to Z3nUser
    @ManyToOne
	@JoinColumn(name="USER_ID")
	private Z3nUser z3nUser;

    public Z3nGroupsUser() {
    }

	public int getGuId() {
		return this.guId;
	}

	public void setGuId(int guId) {
		this.guId = guId;
	}

	public int getGroupLevel() {
		return this.groupLevel;
	}

	public void setGroupLevel(int groupLevel) {
		this.groupLevel = groupLevel;
	}

	public Z3nGroup getZ3nGroup() {
		return this.z3nGroup;
	}

	public void setZ3nGroup(Z3nGroup z3nGroup) {
		this.z3nGroup = z3nGroup;
	}
	
	public Z3nUser getZ3nUser() {
		return this.z3nUser;
	}

	public void setZ3nUser(Z3nUser z3nUser) {
		this.z3nUser = z3nUser;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + guId;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Z3nGroupsUser)) {
			return false;
		}
		Z3nGroupsUser other = (Z3nGroupsUser) obj;
		if (guId != other.guId) {
			return false;
		}
		return true;
	}
	
}